package my.data.x.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class XSeqGen {
    @Value("${worker.id}")
    private Integer workerId;
    @Value("${data.center.id}")
    private Integer datacenterId;
    private static XSeq xSeq=null;
    private XSeqGen(){};
    public long getID(){
        if(xSeq==null){
            xSeq=new XSeq(workerId,datacenterId);
        }
        return xSeq.nextId();
    }


}
